﻿@{
    ViewBag.Title = "IndexPiece";
    Layout = "~/Views/Shared/_SelfInfoLayout.cshtml";
}
@model IEnumerable<SelfInfo.Models.PIECE>
<h2>Index PIECE</h2>


<div class='row'>
   <div class='col-md-2'>
    @Html.DropDownList("PIECETYPE", null, new { @class = "form-control"})    
   </div>
   <div class='col-md-2 v-center'>SHOW ALL: @Html.CheckBox("ISSHOW",false)</div>
</div>


<div class='row'>
<table class="table table-striped">
   <thead>
      <tr>
         <td>ID</td>
         <td>TYPE</td>
         <td>NAME</td>
         <td>STARTDATE</td>
         <td>ENDDATE</td>
         <td>BRIEF</td>
         <td>COMMENT</td>
         <td>SCORE</td>
         <td>RESULT</td>
      </tr>
   </thead>
   <tbody>
    @foreach (var item in Model)
    {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.TYPE)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.NAME)
        </td>
       
         <td>
            @Html.DisplayFor(modelItem => item.STARTDATE, "DataYYMMDD")
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ENDDATE, "DataYYMMDD")
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BRIEF)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.COMMENT)
        </td>
         <td>
            @Html.DisplayFor(modelItem => item.SCORE)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RESULT)
        </td>
        <td>
            <a id='model_create' data-toggle="modal" data-target="#view_create" href="/selfinfo/piece/edit/@item.ID">Edit</a>
        </td>
    </tr>
    }
   </tbody>

</table>
</div>

<div class='row'>
<div  class='col-md-2'>
      <a id='model_create' class="btn btn-primary" data-toggle="modal" data-target="#view_create" href="/selfinfo/piece/create">Create One</a>
   </div>
</div>


<div  class="modal fade" id="view_create" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog">
    <div class="modal-content"> 
      <div class='modal-body'>
      </div>
    </div>
 </div>
</div>

<div id="view_delete" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
        <a href="#" data-dismiss="modal" aria-hidden="true" class="close">×</a>
         <h3>Delete</h3>
    </div>
    <div class="modal-body">
        <p>You are about to delete!</p>
        <p>Do you want to proceed?</p>
    </div>
    <div class="modal-footer">
      <a href="#" id="btnYes" class="btn danger">Yes</a>
      <a href="#" data-dismiss="modal" aria-hidden="true" class="btn secondary">No</a>
    </div>
</div>
</div>


<script>
    $(document).ready(function () {
        $('#PIECETYPE').change(function () {
            var type = $(this).children('option:selected').val();

            window.location = "/selfinfo/piece/index/" + type;

        });

        $("#ISSHOW").change(function () {
            var isShow = $(this)[0].checked;
            var type = $('#PIECETYPE').children('option:selected').val();
            window.location = "/selfinfo/piece/index?id=" + type + "&isShow=" + isShow;
            // alert(isShow);
        });

        
    });
</script>
